<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <!-- edge内核兼容 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- 百度禁止转码 -->
  <meta http-equiv="Cache-Control" content="no-siteapp">
  <!-- uc强制竖屏 -->
  <meta name="screen-orientation" content="portrait">
  <!-- QQ强制竖屏 -->
  <meta name="x5-orientation" content="portrai">
  <!-- 是否启用全屏模式 -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <!-- webapp标题 -->
  <meta name="apple-mobile-web-app-title" content="webapp标题" />
  <!-- 禁用电话号码邮箱自动识别 -->
  <meta name="format-detection" content="telephone=no,email=no">
  <title>document</title>
</head>

<body>
  <input type="file" name="" id="file">
  <script>
    var input = document.getElementById('file')
    var reader
    input.addEventListener('change', function (e) {
      reader = new FileReader()
      var file = e.target.files[0]
      reader.addEventListener('load', function (e) {
        console.log(e)
        console.log(reader);
      }, false)
      reader.readAsText(file)
      //reader.readAsDataURL(file)
      //reader.readAsArrayBuffer(file)
    }, false)

  </script>
</body>

</html>